<html style="height: 100%">
<head><#include "/base/head.html">
</head>
<body style="height: 100%">
	<div style="padding: 10px; height: 95%;">
		<div style="height: 25%;">

	

                             
			<form id="symptomForm" method="post" action="${contextPath}/expert/querySymptom">
				<table cellpadding="8">
					<tbody>
						<tr>
							<td>ID:</td>
							<td><input class="easyui-textbox" type="text" name="id" /></td>
							<td>症状名:</td>
							<td><input class="easyui-textbox" type="text" name="symptomname" /></td>
							<td>级别:</td>
							<td><input class="easyui-textbox" type="text" name="level" /></td>
						</tr>

					</tbody>
				</table>
			</form>
			<div style="text-align: left; padding: 5px">
				<a id="symptomSearchSubmit" href="javascript:void(0)" class="easyui-linkbutton mediumButton">查询</a>
			</div>
		</div>
		<script type="text/javascript">
			$(function() {
				init();

				var deleteUrl = "";

				$("#symptomSearchSubmit").click(function() {
					refreshGrid();
				});
				//点击编辑用户
				$("#symptomEdit").click(function() {

					var selected = $("#symptomGrid").datagrid('getSelected');
					if (selected == null) {
						alert("请先选择症状");
						return;
					}

					$("#symptomFormEdit").attr("action", $(this).attr("postUrl"));
					$('#symptomFormDlg').dialog({
						"iconCls" : "icon-edit",
						"title" : "症状修改"
					});
					$('#symptomFormDlg').dialog('open');

					var params = new Object();
					params.id = selected.id;
					$("#symptom_id").val(selected.id);
					console.log($("#symptom_id").find(":input[name=id]"));
					BaseJs.setFormByUrl("#symptomFormEdit", params);
				});
				//初始化页面
				function init() {
					$("#symptomFormEdit").form('clear');
					$("#symptomForm").form('clear');

					refreshGrid();
				}

				//根据form里面的信息获取并填充grid
				function refreshGrid() {
					BaseJs.formChangeGrid("#symptomForm", "#symptomGrid");
				}

				$("#symptomAdd").click(function() {

					$("#symptomFormEdit").form('clear');
					$("#symptomFormEdit").attr("action", $(this).attr("postUrl"));
					$('#symptomFormDlg').dialog({
						"iconCls" : "icon-add",
						"title" : "症状新增"
					});

					$("#symptom_id").val("");
					$('#symptomFormDlg').dialog('open');
				});

				$("#symptomDelete").click(function() {
					alert("sds");
					var selected = $("#symptomGrid").datagrid('getSelected');
					if (selected == null) {
						alert("请先选择症状");
						return;
					}
					var params = new Object();
					params.id = selected.id;
					BaseJs.ajax($(this).attr('postUrl'), params, function() {
						refreshGrid();
						alert("删除症状成功");
					})

				});
				//修改的弹出框按提交
				$("#symptomSubmitEdit").click(function() {
					BaseJs.submitForm("#symptomFormEdit", function(rData) {
						//修改完重新查询
						$("#symptomSearchSubmit").click();
						$('#symptomFormDlg').dialog('close');
					});
				});
			});
		</script>
		<div style="height: 75%">
			<div id="symptomToolbar">
				<a id="symptomAdd" postUrl="${contextPath}/expert/addUpdateSymptom" href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-add" plain="true">新增症状</a> <a id="symptomEdit" postUrl="expert/addUpdateSymptom" href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-edit" plain="true">编辑症状</a> <a id="symptomDelete" postUrl="expert/deleteSymptom" href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-remove" plain="true">删除症状</a>
			</div>

			<div id="symptomFormDlg" class="easyui-dialog" title="症状新增" data-options="iconCls:'icon-add',closed: true" style="width: 400px; height: 400px; padding: 10px; text-align: center;">
				<!-- 弹出框用来增加和编辑-->
				<form id="symptomFormEdit" method="post" action="" loadAction="expert/getSymptom">
					<table align="center" cellpadding="8">

						<tr>
							<td>症状名:</td>
							<td><input class="easyui-textbox" type="text" name="name" /></td>
						</tr>
						<tr>
							<td>描述:</td>
							<td><div>
									<input class="easyui-textbox" type="text" name="description" />
								</div></td>
						</tr>
						<tr>
							<td>级别:</td>
							<td><div>
									<input class="easyui-textbox" type="text" name="level" />
								</div></td>
						</tr>
						<tr>
							<td>父类:</td>
							<td><div>
									<input class="easyui-textbox" type="text" name="parentId" />
								</div></td>
						</tr>
						<tr>
							<td>次数:</td>
							<td><div>
									<input class="easyui-textbox" type="text" name="frequency" />
								</div></td>
						</tr>
					</table>
					<input type="hidden" id="symptom_id" name="id">
				</form>

				<div style="text-align: center; margin: 10px">
					<a id="symptomSubmitEdit" href="javascript:void(0)" class="easyui-linkbutton mediumButton">确定</a> &nbsp; <a href="javascript:void(0)" class="easyui-linkbutton mediumButton" onclick=" $('#symptomFormDlg').dialog('close');">取消</a>
				</div>
			</div>

			<table id="symptomGrid" toolbar="#symptomToolbar" class="easyui-datagrid" title="症状显示" style="width: 100%; height: 100%;" data-options="singleSelect:true,method:'post',fitColumns : true">
				<thead>
					<tr>
						<th data-options="field:'id',width:50,align:'center'">症状ID</th>
						<th data-options="field:'name',width:100,align:'center'">症状名</th>
						<th data-options="field:'description',width:100,align:'center'">描述</th>
						<th data-options="field:'level',width:100,align:'center'">级别</th>
						<th data-options="field:'parentId',width:100,align:'center'">父类</th>
						<th data-options="field:'frequency',width:100,align:'center'">次数</th>

				</thead>
			</table>
		</div>
		<div id="setRoleInfoDlg" style="display: none;">
			<div id='memberEditDlgPanel'></div>
			<div id='doctorEditDlgPanel'></div>
		</div>
	</div>
</body>
</html>